package com.myrslok.module;

import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.util.HashSet;
import java.util.Set;

public class BasicModuleSettings implements ModuleSettings {

    @NotNull
    protected final File moduleRoot;
    @NotNull
    protected final Set<File> srcDirs = new HashSet<File>();
    @NotNull
    protected final Set<File> testDirs = new HashSet<File>();
    @NotNull
    protected File buildDir;
    @NotNull
    protected File targetDir;
    @NotNull
    protected File targetProdClassesDir;
    @NotNull
    protected File targetTestClassesDir;
    @NotNull
    protected File targetBuildClassesDir;
    @NotNull
    protected Set<File> prodLibs = new HashSet<File>();
    @NotNull
    protected Set<File> testLibs = new HashSet<File>();

    /**
     * Creates an empty module with the name <code>module</code> under <code>module</code> dir.
     * @param module the name (and dir) of the module
     */
    public BasicModuleSettings(@NotNull final String module) {
        moduleRoot = new File(module);
    }

    public void addSrcDir(@NotNull final String dir) {
        srcDirs.add(new File(moduleRoot, dir));
    }

    public void addTestDir(@NotNull final String dir) {
        testDirs.add(new File(moduleRoot, dir));
    }

    @Override
    @NotNull
    public File getModuleRoot() {
        return moduleRoot;
    }

    @Override
    @NotNull
    public Set<File> getSrcDirs() {
        return srcDirs;
    }

    @Override
    @NotNull
    public Set<File> getTestDirs() {
        return testDirs;
    }

    @Override
    @NotNull
    public File getBuildDir() {
        return buildDir;
    }

    @Override
    @NotNull
    public File getTargetDir() {
        return targetDir;
    }

    @Override
    @NotNull
    public File getTargetProdClassesDir() {
        return targetProdClassesDir;
    }

    @Override
    @NotNull
    public File getTargetTestClassesDir() {
        return targetTestClassesDir;
    }

    @Override
    @NotNull
    public File getTargetBuildClassesDir() {
        return targetBuildClassesDir;
    }

    @NotNull
    @Override
    public Set<File> getProductionLibs() {
        return prodLibs;
    }

    @NotNull
    @Override
    public Set<File> getTestLibs() {
        return testLibs;
    }

    public void setBuildDir(@NotNull final File buildDir) {
        this.buildDir = buildDir;
    }

    public void setTargetDir(@NotNull final File targetDir) {
        this.targetDir = targetDir;
    }

    public void setTargetProdClassesDir(@NotNull final File targetProdClassesDir) {
        this.targetProdClassesDir = targetProdClassesDir;
    }

    public void setTargetTestClassesDir(@NotNull final File targetTestClassesDir) {
        this.targetTestClassesDir = targetTestClassesDir;
    }

    public void setTargetBuildClassesDir(@NotNull final File targetBuildClassesDir) {
        this.targetBuildClassesDir = targetBuildClassesDir;
    }
    
}
